package com.runoob;

import com.runoob.food.Food;

import java.util.ArrayList;
import java.util.List;

/**
 * 套餐
 * <p>
 *
 * </p>
 *
 * @author zenglei
 * @date 2023/05/30/ 16:05
 */
public class Meal {

    private List<Food> foods = new ArrayList<Food>();

    public void addItem(Food item) {
        foods.add(item);
    }

    public float getCost() {
        float cost = 0.0f;
        for (Food item : foods) {
            cost += item.price();
        }
        return cost;
    }

    public void showFoods() {
        for (Food item : foods) {
            System.out.print("Item : " + item.name());
            System.out.print(", Packing : " + item.packing().pack());
            System.out.println(", Price : " + item.price());
        }
    }

}
